#define ArrLen 497
struct Node
{
    int key;
    int value;
    Node(int key,int value):key(key),value(value) {}
};
class MyHashMap {
private:
    vector<Node*>* arr[ArrLen] ={0};

public:
    /** Initialize your data structure here. */
    MyHashMap() {

    }
    
    /** value will always be non-negative. */
    void put(int key, int value) 
    {
        int newKey = key%ArrLen;
        if(arr[newKey]== 0 )
        {
            arr[newKey] = new vector<Node*>;
        }
        for(int i=0;i<arr[newKey]->size();i++)
        {
            if((*arr[newKey])[i]->key == key)
            {
                (*arr[newKey])[i]->value = value;
                return ;
            }
        }
        arr[newKey]->push_back(new Node(key,value));

    }
    
    /** Returns the value to which the specified key is mapped, or -1 if this map contains no mapping for the key */
    int get(int key) 
    {
        int newKey = key%ArrLen;
        if(arr[newKey]== 0 )
        {
            return -1;
        }
        for(int i=0;i<arr[newKey]->size();i++)
        {
            if((*arr[newKey])[i]->key == key)
            {
                return (*arr[newKey])[i]->value;
            }
        }
        return -1;
    }
    
    /** Removes the mapping of the specified value key if this map contains a mapping for the key */
    void remove(int key) 
    {
        int newKey = key%ArrLen;
        if(arr[newKey]== 0 )
        {
            return ;
        }
        vector<Node *> &  bucket = *(arr[newKey]);
        for(vector<Node *>::iterator iter=bucket.begin();iter != bucket.end() ; iter++)
        {
            if((*iter)->key == key)
            {
                bucket.erase(iter);
                break;
            }
        }

    }
};

/**
 * Your MyHashMap object will be instantiated and called as such:
 * MyHashMap* obj = new MyHashMap();
 * obj->put(key,value);
 * int param_2 = obj->get(key);
 * obj->remove(key);
 */